<script src="https://cdn.staticfile.org/vue/3.2.45/vue.global.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<div class="test"></div>
<style>
    .test {
        height: 2800px;
        background-color: aqua;
    }
</style>

<div id='magcik_ad_bottom_bar'>
    <button class='ad-bar-button' :class="{ 'ad-bar-actives': show}" @click='switchButton'> {{msg}}</button>
    <transition name='ad-bar-fade'>
        <div class='bottom-bar-box' v-if='show'>
            <div class='bottom-bar-content'>
                <a href='https://dongbd.com/wp-content/uploads/app/0329/index.html' target='_blank'>
                    <img src='https://dongbd.com/wp-content/uploads/2022/10/1665676987.gif' />
                </a>
            </div>
        </div>
    </transition>
</div>
<script>
    const App = Vue.createApp({
        setup() {
            //初始化
            let msg = Vue.ref("︾");
            let show = Vue.ref(true);

            //单击按钮触发的方法
            const switchButton = () => {
                show.value = !show.value
                //判断
                if (show.value == true) {
                    //关闭广告
                    msg.value = "︾"
                } else {
                    //开启广告
                    msg.value = "︽"
                }
            }
            //根据状态设定图标
            Vue.onBeforeUpdate(() => {
                if (show.value == true) {
                    //关闭广告
                    msg.value = '︾'
                } else {
                    //开启广告
                    msg.value = '︽'
                }
            })


            return {
                msg,
                show,
                switchButton
            }
        }
    })
    App.mount("#magcik_ad_bottom_bar")



</script>